﻿
//获取access_token：
const https=require("https")
const url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='+	
'wx8752472efb19ba17&secret=f21b5dcaab4d40cea9433bc1dfed3588';

https.get(url,function(response){
    let data="";
    response.on('data',function(chunk){
        data+=chunk;
    })
    response.on('end',function(){
        console.log('http响应结束')
        console.log(data);
    })
})

//新增集合请求地址：https://api.weixin.qq.com/tcb/databasecollectionadd?access_token=ACCESS_TOKEN
//删除：https://api.weixin.qq.com/tcb/databasecollectiondelete?access_token=ACCESS_TOKEN
//查询：https://api.weixin.qq.com/tcb/databasecollectionget?access_token=ACCESS_TOKEN

//在集合中插入记录：https://api.weixin.qq.com/tcb/databaseadd?access_token=ACCESS_TOKEN
//删除记录：https://api.weixin.qq.com/tcb/databasedelete?access_token=ACCESS_TOKEN
//更新记录：https://api.weixin.qq.com/tcb/databaseupdate?access_token=ACCESS_TOKEN
//查询记录：https://api.weixin.qq.com/tcb/databasequery?access_token=ACCESS_TOKEN


//例：前台获取云数据库数据
//let url="/api/tcb/databasequery?access_token=38_DnGoTN8_erlR601gBRPuwnA7gvPgZrZGXsnwHjBk6jEHtY-NnaepuZXz39UVEEGx4cznmLxlvM0bGDB3kJfnO8_NsSpxGnqG15Yrd8h0aLExL0HDqSxzdVUTibiSxtGr6R1oP-wAAhp2VZgKLYAdAIAREG"
// this.$axios.post( url,
    //    {
    //        "env":"minijingdong-6gmzb5oc4447b462",云环境id
    //        "query":"db.collection(\"goods\").get()"查询操作
    //    }
    // ).then(res=>{
    //     console.log(res.data)
    // }).catch(err=>{
    //     console.log(err)
// })